package test.retrofit

import okhttp3.ResponseBody
import org.junit.jupiter.api.Test
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Path

class RetrofitTest {

    @Test
    fun `test`() {
        val retrofit = Retrofit.Builder()
            .baseUrl("https://api.github.com/")
            .build()

        val service: GitHubService = retrofit.create(GitHubService::class.java)
        val call = service.listRepos("acc8226")
        val response  = call.execute()
        println(response)
        println(response.body()?.string())
    }

    interface GitHubService {
        @GET("users/{user}")
        fun listRepos(@Path("user") user: String?): Call<ResponseBody>
    }
}

